/*
 * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

/* This file is autogenerated by ref2h.pl.  Do not edit */
#define _kind_macros_orig_H_


#define KIND_INVALID(k)               (                                      ((k) ==NV_MMU_CLIENT_KIND_INVALID))
#define PTEKIND_INVALID(k)            (                                      ((k) ==NV_MMU_PTE_KIND_INVALID))
#define KIND_UNDEFINED(k)             (                                      !((k) ==NV_MMU_CLIENT_KIND_INVALID)&&                                      !((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)&&                                      !((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_UNDEFINED(k)          (                                      !((k) ==NV_MMU_PTE_KIND_INVALID)&&                                      !((k) ==NV_MMU_PTE_KIND_PITCH)&&                                      !((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)&&                                      !((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)&&                                      !((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define PTEKIND_PITCH(k)              (                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define KIND_BLOCKLINEAR(k)           (                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_BLOCKLINEAR(k)        (                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define PTEKIND_COMPRESSIBLE(k)       (                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define PTEKIND_IS_COMPRESSIBLE(k)    (                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define PTEKIND_DISALLOWS_PLC(k)      (                                      !((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE))
#define PTEKIND_WORK_CREATION_SKED(k) (                                      ((k) ==NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define KIND_BYPASSABLE(k)            (                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY))
#define PTEKIND_BYPASSABLE(k)         (                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) ==NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define ROP_IFACE_KIND_SUPPORTED(k)   (                                      ((k) ==NV_MMU_CLIENT_KIND_INVALID)||                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define KIND_SUPPORTED(k)             (                                      ((k) ==NV_MMU_CLIENT_KIND_INVALID)||                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define KIND_PEERMEM_SUPPORTED(k)     (                                      ((k) ==NV_MMU_CLIENT_KIND_INVALID)||                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define KIND_LOCALMEM_SUPPORTED(k)    (                                      ((k) ==NV_MMU_CLIENT_KIND_INVALID)||                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define KIND_SYSMEM_SUPPORTED(k)      (                                      ((k) ==NV_MMU_CLIENT_KIND_INVALID)||                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_SUPPORTED(k)          (                                      ((k) ==NV_MMU_PTE_KIND_INVALID)||                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define PTEKIND_PEERMEM_SUPPORTED(k)  (                                      ((k) ==NV_MMU_PTE_KIND_INVALID)||                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define PTEKIND_LOCALMEM_SUPPORTED(k) (                                      ((k) ==NV_MMU_PTE_KIND_INVALID)||                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define PTEKIND_SYSMEM_SUPPORTED(k)   (                                      ((k) ==NV_MMU_PTE_KIND_INVALID)||                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) ==NV_MMU_PTE_KIND_SMSKED_MESSAGE))
#define KIND_SWAP_PA8_AND_PA9(k)      (                                      !((k) ==NV_MMU_CLIENT_KIND_ZF32_X24S8))
#define PTEKIND_SWAP_PA8_AND_PA9(k)   (                                      !((k) ==NV_MMU_PTE_KIND_ZF32_X24S8)&&                                      !((k) ==NV_MMU_PTE_KIND_ZF32_X24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_Z(k)                     (                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_Z(k)                  (                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_S8_COMPRESSIBLE_DISABLE_PLC && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_SUPPORTS_SUBKIND_Z(k)    (                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_SUPPORTS_SUBKIND_Z(k) (                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_Z16 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_SUPPORTS_SUBKIND_S(k)    (                                      ((k) >=NV_MMU_CLIENT_KIND_S8 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_SUPPORTS_SUBKIND_S(k) (                                      ((k) >=NV_MMU_PTE_KIND_S8 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) ==NV_MMU_PTE_KIND_S8_COMPRESSIBLE_DISABLE_PLC)||                                      ((k) >=NV_MMU_PTE_KIND_S8Z24_COMPRESSIBLE_DISABLE_PLC && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_C(k)                     (                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY))
#define PTEKIND_C(k)                  (                                      ((k) ==NV_MMU_PTE_KIND_PITCH)||                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE_DISABLE_PLC))
#define KIND_GENERIC_MEMORY(k)        (                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY))
#define PTEKIND_GENERIC_MEMORY(k)     (                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE_DISABLE_PLC))
#define KIND_Z16(k)                   (                                      ((k) ==NV_MMU_CLIENT_KIND_Z16))
#define PTEKIND_Z16(k)                (                                      ((k) ==NV_MMU_PTE_KIND_Z16)||                                      ((k) ==NV_MMU_PTE_KIND_Z16_COMPRESSIBLE_DISABLE_PLC))
#define KIND_Z24(k)                   (                                      ((k) ==NV_MMU_CLIENT_KIND_S8Z24)||                                      ((k) ==NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_Z24(k)                (                                      ((k) ==NV_MMU_PTE_KIND_S8Z24)||                                      ((k) ==NV_MMU_PTE_KIND_Z24S8)||                                      ((k) ==NV_MMU_PTE_KIND_S8Z24_COMPRESSIBLE_DISABLE_PLC)||                                      ((k) ==NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_Z24S8(k)                 (                                      ((k) ==NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_Z24S8(k)              (                                      ((k) ==NV_MMU_PTE_KIND_Z24S8)||                                      ((k) ==NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_S8Z24(k)                 (                                      ((k) ==NV_MMU_CLIENT_KIND_S8Z24))
#define PTEKIND_S8Z24(k)              (                                      ((k) ==NV_MMU_PTE_KIND_S8Z24)||                                      ((k) ==NV_MMU_PTE_KIND_S8Z24_COMPRESSIBLE_DISABLE_PLC))
#define KIND_16BPP_Z(k)               (                                      ((k) ==NV_MMU_CLIENT_KIND_Z16))
#define PTEKIND_16BPP_Z(k)            (                                      ((k) ==NV_MMU_PTE_KIND_Z16)||                                      ((k) ==NV_MMU_PTE_KIND_Z16_COMPRESSIBLE_DISABLE_PLC))
#define KIND_32BPP_Z(k)               (                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)||                                      ((k) ==NV_MMU_CLIENT_KIND_S8Z24)||                                      ((k) ==NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_32BPP_Z(k)            (                                      ((k) ==NV_MMU_PTE_KIND_GENERIC_MEMORY)||                                      ((k) ==NV_MMU_PTE_KIND_S8Z24)||                                      ((k) ==NV_MMU_PTE_KIND_Z24S8)||                                      ((k) >=NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE && (k) <= NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE_DISABLE_PLC)||                                      ((k) ==NV_MMU_PTE_KIND_S8Z24_COMPRESSIBLE_DISABLE_PLC)||                                      ((k) ==NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_64BPP_Z(k)               (                                      ((k) ==NV_MMU_CLIENT_KIND_ZF32_X24S8))
#define PTEKIND_64BPP_Z(k)            (                                      ((k) ==NV_MMU_PTE_KIND_ZF32_X24S8)||                                      ((k) ==NV_MMU_PTE_KIND_ZF32_X24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_ZF32(k)                  (                                      ((k) ==NV_MMU_CLIENT_KIND_ZF32_X24S8))
#define PTEKIND_ZF32(k)               (                                      ((k) ==NV_MMU_PTE_KIND_ZF32_X24S8)||                                      ((k) ==NV_MMU_PTE_KIND_ZF32_X24S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_S8(k)                    (                                      ((k) ==NV_MMU_CLIENT_KIND_S8))
#define PTEKIND_S8(k)                 (                                      ((k) ==NV_MMU_PTE_KIND_S8)||                                      ((k) ==NV_MMU_PTE_KIND_S8_COMPRESSIBLE_DISABLE_PLC))
#define KIND_STENCIL(k)               (                                      ((k) >=NV_MMU_CLIENT_KIND_S8 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))
#define PTEKIND_STENCIL(k)            (                                      ((k) >=NV_MMU_PTE_KIND_S8 && (k) <= NV_MMU_PTE_KIND_Z24S8)||                                      ((k) ==NV_MMU_PTE_KIND_S8_COMPRESSIBLE_DISABLE_PLC)||                                      ((k) >=NV_MMU_PTE_KIND_S8Z24_COMPRESSIBLE_DISABLE_PLC && (k) <= NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC))
#define SURFACE_FORMAT_IS_GENERIC_MEMORY(k)(                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY))
#define KIND_PARTIAL(k)              (0)
#define PTEKIND_WORK_CREATION_HOST(k)    (0)
#define PTEKIND_SUPPORTS_SUBKIND_VCAA(k)    (0)
#define PTEKIND_NO_SWIZZLE(k)    (0)
#define PTEKIND_WORK_CREATION(k) ((                                      ((k) ==NV_MMU_PTE_KIND_SMSKED_MESSAGE)) || (0))
#define SURFACE_FORMAT_HAS_COLOR(k, b)   ((                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)) && (b >= 0) && (b < 3))
#define SURFACE_FORMAT_HAS_DEPTH(k, b)   (((                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)) && (b == 3)) || ((                                      ((k) >=NV_MMU_CLIENT_KIND_Z16 && (k) <= NV_MMU_CLIENT_KIND_Z24S8))))
#define SURFACE_FORMAT_HAS_STENCIL(k, b) ((k == NV_MMU_CLIENT_KIND_Z24S8) || (k == NV_MMU_CLIENT_KIND_S8Z24) || (k == NV_MMU_CLIENT_KIND_ZF32_X24S8) || (k == NV_MMU_CLIENT_KIND_S8))
#define SURFACE_FORMAT_HAS_Z24(k, b) ((k == NV_MMU_CLIENT_KIND_Z24S8) || (k == NV_MMU_CLIENT_KIND_S8Z24))
#define SURFACE_FORMAT_IS_8BPP_S(k, b)  (k == NV_MMU_CLIENT_KIND_S8)
#define SURFACE_FORMAT_IS_16BPP_Z(k, b) (k == NV_MMU_CLIENT_KIND_Z16)
#define SURFACE_FORMAT_IS_32BPP_Z(k, b) (((                                      ((k) ==NV_MMU_CLIENT_KIND_GENERIC_MEMORY)) && (b == 3))|| (k == NV_MMU_CLIENT_KIND_Z24S8) || (k == NV_MMU_CLIENT_KIND_S8Z24))
#define SURFACE_FORMAT_IS_64BPP_Z(k, b) (k == NV_MMU_CLIENT_KIND_ZF32_X24S8)
#define PTEKIND_TO_KIND_FOR_CLIENT(k) ((((k)==NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE) || ((k)==NV_MMU_PTE_KIND_GENERIC_MEMORY_COMPRESSIBLE_DISABLE_PLC) || ((k) == NV_MMU_PTE_KIND_GENERIC_MEMORY)) ? NV_MMU_CLIENT_KIND_GENERIC_MEMORY : ((((k)==NV_MMU_PTE_KIND_S8_COMPRESSIBLE_DISABLE_PLC) || ((k)==NV_MMU_PTE_KIND_S8)) ?  NV_MMU_CLIENT_KIND_S8 : ((((k)==NV_MMU_PTE_KIND_Z16_COMPRESSIBLE_DISABLE_PLC) || ((k)==NV_MMU_PTE_KIND_Z16)) ? NV_MMU_CLIENT_KIND_Z16 : ((((k)==NV_MMU_PTE_KIND_S8Z24_COMPRESSIBLE_DISABLE_PLC) || ((k)==NV_MMU_PTE_KIND_S8Z24)) ? NV_MMU_CLIENT_KIND_S8Z24 : ((((k)==NV_MMU_PTE_KIND_Z24S8_COMPRESSIBLE_DISABLE_PLC) || ((k)==NV_MMU_PTE_KIND_Z24S8)) ? NV_MMU_CLIENT_KIND_Z24S8 : ((((k)==NV_MMU_PTE_KIND_ZF32_X24S8_COMPRESSIBLE_DISABLE_PLC) || ((k)==NV_MMU_PTE_KIND_ZF32_X24S8)) ? NV_MMU_CLIENT_KIND_ZF32_X24S8 : ((((k)==NV_MMU_PTE_KIND_PITCH) || ((k)==NV_MMU_PTE_KIND_SMSKED_MESSAGE))? NV_MMU_CLIENT_KIND_GENERIC_MEMORY : NV_MMU_CLIENT_KIND_INVALID)))))))

